package com.yonyou.common.service.messagecenter.rabbitmq;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.yonyou.common.service.messagecenter.rabbitmq.entity.MessageProtocol;


@Component
public class MessageProducerUtil {
	@Autowired
    private static MessageProducer messageProducer;
	
	@Autowired(required = true)
	public void setMessageProducer(MessageProducer messageProducer) {
		MessageProducerUtil.messageProducer = messageProducer;
	}
	
	public static void SendDemoMessage(MessageProtocol msg) {
		//messageProducer.sendMessage("exchange1", "queue1", msg);
		messageProducer.reqSendMessage("exchange2", "", msg);
	}
	
	public static boolean SendMessage(MessageProtocol msg,String exchange,String route) {
		return messageProducer.reqSendMessage(exchange, route, msg);
	}
}
